<template>
	<view class="container">
		<navBar title="施工前条件验收审核" @goBack="uni.navigateBack()"></navBar>
		
		<view class="audit-opinion">
			<view class="title required">审核意见</view>
			<view class="textarea">
				<u-textarea v-model="value" placeholder="请输入内容" confirmType="done"></u-textarea>
				<record @setText="description" class="form-item-icon form-item-icon-voice"></record>
				<image @click="value = ''" mode="scaleToFill" class="form-item-icon form-item-icon-clear" src="/static/image/login/del1.png"></image>
			</view>
		</view>
		
<!-- 		<view style="height: 46px;"></view>
		<view class="btn">
			<u-button :loading="loading" @click="confirm" type="primary" text="确定"></u-button>
		</view> -->
		<view class="footer-button">
			<view class="button-placeholder"></view>
			<view class="button-group">
				<button @click="confirm" :loading="loading" class="button-primary">确定</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: "",
				loading: false
			}
		},
		methods: {
			description(text){
				this.value += text
			},
			confirm() {
				if (this.loading) return
				this.loading = true
				if (!this.value.trim()) {
					uni.showToast({ title: "请填写审核意见", icon: "none" })
					this.loading = false
					return
				}
				this.$$emit("monitorOpinion", this.value)
				// this.loading = false
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		box-sizing: border-box;
		height: 100vh;
		overflow: hidden;
		/* #ifdef MP-WEIXIN */
		padding-top: 200rpx;
		/* #endif */
	}
	.required {
		&::before {
			content: "*";
			color: #ff4646;
			font-size: 16px;
			line-height: 29px;
		}
	}
	.audit-opinion {
		box-sizing: border-box;
		border-top: 15px solid #f5f7fa;
		background: #fff;
		font-size: 16px;
		padding: 0 14px;
		.title {
			line-height: 50px;
			margin-top: 5px;
			color: #445469;
		}
		.textarea {
			width: 100%;
			position: relative;
			.form-item-icon {
				width: 48rpx;
				height: 48rpx;
			}
			
			.form-item-icon-voice {
				position: absolute;
				top: 10rpx;
				right: 16rpx;
				z-index: 100;
			}
			.form-item-icon-clear{
				position: absolute;
				right: 16rpx;
				bottom: 10rpx;
				z-index: 100;
			}
		}
	}
	.btn {
		position: fixed;
		bottom: 0;
		width: 100vw;
		padding: 0 15px;
		box-sizing: border-box;
		height: 46px;
		> * {
			height: inherit;
			line-height: 46px;
		}
	}
</style>
